package com.example.demo.configuration.config;

import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class RabbitMQConfig {

   @Bean
    public RabbitTemplate customRabbitTemplate(){
       CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
       connectionFactory.setAddresses("127.0.0.1:5672");
       connectionFactory.setUsername("remote");
       connectionFactory.setPassword("remote");
       return new RabbitTemplate(connectionFactory);
   }
}
